package com.jaws.demo.service;

import javax.annotation.Resource;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class MailService {
	@Resource
	private JavaMailSender mail;
	
	public void send(){
		//建立邮件消息
		SimpleMailMessage mainMessage = new SimpleMailMessage();
		//发送者
		mainMessage.setFrom("80884690@qq.com");
		//接收者
		mainMessage.setTo("80884690@qq.com");
		//发送的标题
		mainMessage.setSubject("测试邮件");
		//发送的内容
		mainMessage.setText("hello world");
		
		mail.send(mainMessage);
	}

}
